package com.dispacher.config;

import java.util.ResourceBundle;

public abstract class GlobalConfig {
	private static ResourceBundle bundle = ResourceBundle.getBundle(Constants.CONFIG_PROP_NAME);
	private static final String DEFAULT_NAME_SPACE = "action";
	private static String[] CONFIG_URL_PREFIXS = null;

	public static String getProperty(String name) {
		String result = null;
		try {
			result = bundle.getString(name);
		} catch (Exception e) {
			System.out.println("no configuration while reading the configuratoin file");
		}
		return result;
	}

	public static String[] getUrlSuffix() {
		String urls = getProperty(Constants.URL_SUFFIX);
		if (urls == null || urls.trim().equals("")) {
			urls = DEFAULT_NAME_SPACE;
		}
		if (CONFIG_URL_PREFIXS == null) {
			CONFIG_URL_PREFIXS = urls.split(",");
		}
		return CONFIG_URL_PREFIXS;
	}
}
